package com.mcms.service.dw;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUpload;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.servlet.ServletFileUpload;

import com.mcms.util.CalendarUtil;
import com.mcms.util.DBHelper;
import com.mcms.util.GetParamsUtil;
import com.mcms.util.McmsApiConfig;
import com.mcms.web.vo.DWZResult;

public class AddCustomQDService {

	public static void execute(HttpServletRequest request){
		
		boolean isSuc = true;
		String uuid = request.getParameter("customId");
		String isSubscribeDoctor = request.getParameter("is_subscribe_doctor");
		
		//插入用户基本信息
		isSuc = new AddCustomBasicInfoService().execute(request, uuid);
		
		//插入问诊信息
		isSuc = new AddCustomInquiryInfoService().execute(request, uuid);
		
		if("0".equals(isSubscribeDoctor) || isSubscribeDoctor == "0"){//预约就诊
			isSuc = new AddSubscribeDoctorInfoService().execute(request, uuid);
//			isSuc = isSuc || addSubscribeDoctorInfo(request,uuid);
		}
		
		//处理结果
//		dealResult(request,isSuc);
	}
	
	public static void dealResult(HttpServletRequest request,boolean isSuc){
		DWZResult dwzResult = new DWZResult();//"message":"操作成功", "navTabId":"navNewsLi", "forwardUrl":"", "callbackType":"closeCurrent"}
		dwzResult.setNavTabId("page_dw2");
//		dwzResult.setRel("page_sc1"); 
		dwzResult.setMessage("操作成功");  
		dwzResult.setStatusCode("200");  
//		dwzResult.setCallbackType("closeCurrent");  
//		dwzResult.setForwardUrl("customList.html?userName=aaa&deptCode=sc&actionType=listCustom");
		
		request.setAttribute("dwzResult", dwzResult);
	}
}
